//
// Created by 14674 on 25-7-9.
//

#ifndef TEST_H
#define TEST_H

#include "sys_clock.h"
#include "crypt_algid.h"
#include "crypt_types.h"

#define MAX_PLAIN_TEXT_LEN 2048
#define CIPHER_TEXT_EXTRA_LEN 97
#define CRYPT_EAL_PKEY_KEYMGMT_OPERATE 0

#define SM3_MD_SIZE 32
#define SM2_POINT_SINGLE_COORDINATE_LEN 32
#define SM2_POINT_COORDINATE_LEN 65



#define ASSERT_TRUE(TEST)                   \
    do {                                    \
        if (!(TEST)) {                      \
            goto EXIT;                      \
        }                                   \
    } while (0)
#define ASSERT_EQ(VALUE1, VALUE2)                       \
    do {                                                \
        int64_t value1__ = (int64_t)(VALUE1);           \
        int64_t value2__ = (int64_t)(VALUE2);           \
        if (value1__ != value2__) {                     \
            goto EXIT;                                  \
        }                                               \
    } while (0)

/*** sm3test function ***/
void test_sm3(void);
void test_sm3_mut(void);

/*** sm2test function ***/
void test_sm2_sign_and_verify(void);
void test_sm2_enc_and_dec(void);
void test_sm2(void);

/*** sm4test function ***/

void modes_sm4(CRYPT_CIPHER_AlgId cipher_id, CRYPT_PaddingType padding_id, bool padding);
void test_sm4(void);

/*** benchmark test function ***/
int32_t sm3_benchmark(void);
int32_t sm3_compress_benchmark(void);
int32_t sm2_keygen_benchmark(void *ctx);
int32_t sm2_sign_benchmark(void *ctx);
int32_t sm2_verify_benchmark(void *ctx);
int32_t sm2_enc_benchmark(void *ctx);
int32_t sm2_dec_benchmark(void *ctx);

/*** openhitls test interface ***/
void test_openhitls(void);
void test_benchmarks(void);

#endif //TEST_H
